package com.example.springbootdeep2.configuration;

import com.example.springbootdeep2.annotation.EnableHelloWorldSelector;
import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

import java.util.Map;

public class HelloWorldConfigurationSelector implements ImportSelector {

    // 该方法实现 选择注入哪些配置
    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {

        // 获取model annotationMetadata 的参数
        // 原参数获取注解的属性
        Map<String, Object> attributes = annotationMetadata.getAnnotationAttributes(EnableHelloWorldSelector.class.getName());
        System.out.println("=================model====>" + attributes.get("model"));

        return new String[]{
                HelloWorldConfiguration.class.getName()
        };
    }

}